//
// Nemo
//
.nemo-window {
  .nemo-places-sidebar {
    background-color: $bg_color;

    &.frame { border-width: 0; }

    .places-treeview {
      &:not(:hover):not(:selected) { background-color: transparent; }
    }
  }

  // Rename entry
  .nemo-window-pane widget.entry {
    border-radius: 3px;
    padding: 3px 10px;
    border: 2px solid $primary_color;
    background-color: rgba($primary_color, 0.1);

    &:selected {
      &:focus, & {
        @extend %selected_items;
      }
    }
  }

  toolbar.primary-toolbar {
    transition: background-color $shorter_duration $deceleration_curve, color $longer_duration $deceleration_curve;
    padding: 0 6px;
    box-shadow: $shadow_6;
    background-color: $titlebar_bg_color;
    color: $titlebar_fg_color;
    border: none;

    &:backdrop {
      color: $titlebar_secondary_fg_color;
    }

    > toolitem > box.raised > button,
    > toolitem > box.linked.raised > button {
      @extend %header_button;
      min-height: $medium_size;
      min-width: $medium_size;
      margin: 4px 2px;
      padding: 0 0;
    }

    .linked.path-bar > button {
      @extend %header_pathbar_button;
      min-height: 0;
      margin: 4px 0;
      padding: 0 10px;

      &:first-child, &:last-child {
        padding: 0 6px;
      }

      image, label {
        padding-left: 0;
        padding-right: 0;
      }
    }
  }

  .sidebar {
    scrolledwindow.frame { border: none; } // Removed treeview double borders
  }

  .toolbar button { @extend %flat_button; }
}

/*********
 * Tilix *
 *********/
overlay > revealer {
  &.left > scrolledwindow.frame,
  &.right > scrolledwindow.frame {
    border-style: none;
    box-shadow: $shadow_4;
  }

  &.left > scrolledwindow.frame { margin-right: 32px; }
  &.right > scrolledwindow.frame { margin-left: 32px; }
}

.terminix-session-sidebar, // for backwards compatibility
.tilix-session-sidebar { background-image: image($lighter_bg_color); }

button.image-button.session-new-button { min-width: $medium_size - 4px; }


/***********
 * Eclipse *
 ***********/
window.background > box.vertical > scrolledwindow > widget toolbar {
  padding: 2px;

  separator,
  button { margin: 2px; }

  button { border-radius: $buttons_radius; }
}


/************
 * Chromium *
 ************/
window.background.chromium {
  background-color: if($variant == 'light', $bg_color, $menu_bg_color);

  // FIXME: no way to change the toolbar button colors only
  // toolbar button { color: $secondary_fg_color; }

  // toolbar's border-bottom refers to button's border
  entry,
  > button:not(.suggested-action):not(.destructive-action) { border: 1px solid $alt_border_color; }

  > button {
    box-shadow: none;
    background-size: auto;

    &:hover { background-image: image($divider_color); }

    &:active { background-image: image($track_color); }
  }

  // workaround for headerbar's non-animatable buttons
  headerbar button:active { background-size: 1000% 1000%; }

  spinner { color: $primary_color; }

  // entry uses this as well
  textview { background-color: $menu_bg_color; }
}

tooltip.background.chromium { background-color: rgba($base_color, 1); }


/***********
 * Firefox *
 ***********/
window.background:not(.csd) {
  > widget {
    // for the bookmark toolbar's separators
    > separator { color: $alt_border_color; }

    // avoid black border
    > scrollbar { background-clip: border-box; }

    // emphasize borders color
    > scrollbar,
    > frame > border { border-color: $alt_border_color; }

    > entry,
    > button > button {
      border: 1px solid $alt_border_color;
      border-radius: $buttons_radius + 1px;
      box-shadow: none;
    }

    > entry {
      min-height: 32px - 2px;

      &:focus { border-color: $primary_color; }
    }

    > button > button {
      padding: 4px 8px;
      background-size: auto;
      // color: $fg_color;

      &:hover { background-image: image(gtkalpha(currentColor, 0.1 / 2)); }
      &:active { background-image: image(gtkalpha(currentColor, 0.1)); }
    }

    // use 16px assets for hard-coded sizing
    > checkbutton > check { @extend %small_check; }
    > radiobutton > radio { @extend %small_radio; }

    // make check/radio visible regardless of whether the background is bright or dark
    > checkbutton > check:not(:checked),
    > radiobutton > radio:not(:checked) {
      color: $grey_600;

      &:hover, &:active { color: $grey_900; }
      &:disabled { color: rgba($grey_600, 0.5); }
    }
  }

  > menu,
  > menu > menu {
    // border: none;
    border-radius: 0;
  }

  // remove ugly border around the menus
  > window > menu,
  > menu > menu { border: none; }
}

// Firefox now uses this for selected items
text:selected { @extend %selected_items; }

// for backwards compatibility
window.background:not(.csd) {
  > widget {
    > menubar {
      color: $titlebar_secondary_fg_color;

      &:hover { color: $titlebar_fg_color; }
      &:disabled { color: $titlebar_disabled_secondary_fg_color; }
    }

    > frame { color: $alt_border_color; }

    > checkbutton > check,
    > radiobutton > radio {
      margin: 0;
      padding: 0;
    }
  }

  > window.background > menu > separator { color: $solid_border_color; }
}

//
// Firefox Quantum
//
#MozillaGtkWidget.background {
  &, decoration { border-radius: 2px 2px 0 0; } // enforce radius

  // FIXME: unset all our specific titlebuttons
  // until upstream stops rendering useless (weird) icons
  headerbar.titlebar {
    border-radius: 2px 2px 0 0;
    box-shadow: inset 0 1px $titlebar_highlight_color;

    &.default-decoration button.titlebutton {
      @extend %title_buttons_solid;
    }

    // &.default-decoration button.titlebutton {
    //   min-width: 16px;
    //   min-height: 16px;
    //   margin: 0 2px;
    //   padding: 0;
    //   color: $titlebar_fg_color;
    //   background-color: transparent;
    // }
  }
}


 /*************
  * RhythmBox *
  *************/

// add top-border to inline-toolbar
.sidebar-paned .inline-toolbar.horizontal.sidebar-toolbar {
  box-shadow: inset 0 1px $border_color;
}

// tweak border and frame in alt-toolbar
window.csd > box.vertical > box.vertical,
window.solid-csd > box.vertical > box.vertical {

  > toolbar.horizontal {
    margin: -1px 0;
    border-top: 1px solid $border_color;
    box-shadow: none;
    background-color: transparent;

    button {
      min-height: 36px;
      min-width: 36px;
      padding: 0;
      margin-top: 8px;
      margin-bottom: 8px;
      border-radius: 100px;
      -gtk-outline-radius: 100px;
    }
  }

  > frame {
    margin: -1px 0;
    padding: 0;

    > border { border: none; }
  }
}


// force using circle buttons for 'play/pause' etc
window.background > box.vertical > box.vertical > toolbar {
  button,
  .linked > button {
    min-width: 52px;
    min-height: 52px;
    padding: 0;
    margin: 0;
    border-radius: 100px;
    -gtk-outline-radius: 100px;
  }
}

window.background > box.vertical > toolbar.primary-toolbar {

  toolitem {

    &:first-child { // 'prev/play/next'
      .linked > button.image-button.raised {
        min-width: 52px;
        min-height: 52px;
        margin: 0;
        padding: 0;
        border-radius: 100px;
        -gtk-outline-radius: 100px;

        > widget > box > image { padding: 0; }
      }
    }

    .linked > button.image-button.raised { // 'shuffle/repeat'
      min-height: 36px;
      min-width: 36px;
      padding: 0;
      border-radius: 100px;
      -gtk-outline-radius: 100px;
    }

    button.flat.scale { // 'volume'
      min-height: 36px;
      min-width: 36px;
      padding: 0;
      margin-top: 12px;
      margin-bottom: 12px;
      border-radius: 100px;
      -gtk-outline-radius: 100px;
    }
  }
}

 /***********
  *  Geary  *
  ***********/

%folder_frame_border { border-width: 0; }

%folder_frame {
  &:dir(ltr) { border: none; }
  &:dir(rtl) { border: none; }

  // treeview.view.sidebar {
  // }
}

.geary-titlebar-right,
.geary-titlebar-left {
  // remove unexpected "hardcoded" vertical separator
  .solid-csd & { border-radius: 0; box-shadow: none; }
  separator { opacity: 0; }
}

// left-pane styling (legacy)
.sidebar.vertical > paned.sidebar-pane-separator {

  .folder-frame {
    > border { @extend %folder_frame_border; }

    > scrolledwindow { @extend %folder_frame; }
  }
}

// left-pane styling (current)
.sidebar.vertical > paned.geary-sidebar-pane-separator {

  .geary-folder-frame {
    > border { @extend  %folder_frame_border; }

    > scrolledwindow { @extend %folder_frame; }
  }
}

// right-pane styling (current)
stack#conversation_viewer {
  scrolledwindow.geary-conversation-scroller > viewport.frame {
    border: none; // unset borders
  }
}

window.geary-main-window.background.csd, // > 3.36.0
window#GearyMainWindow.background.csd {
  box.vertical > paned.horizontal > box.sidebar.vertical {
    border-bottom-left-radius: $windows_radius;

    statusbar {
      border-bottom-left-radius: $windows_radius;
    }
  }

  stack#conversation_viewer {
    border-bottom-right-radius: $windows_radius;

    scrolledwindow.geary-conversation-scroller {
      viewport.frame {
        list.conversation-listbox {
          background: none;
          border-bottom-right-radius: $windows_radius;
        }
      }
    }
  }
}

/************
 * Inkscape *
 ************/
#ToolboxCommon {
  > #AuxToolbox {
    #StyleSwatch { font-size: smaller; }

    #Kludge { padding: 0; }

    spinbutton,
    entry { min-height: 32px; }

    button:not(.up):not(.down) {
      min-height: 24px;
      min-width: 16px;
      padding: 4px 8px;
      border-radius: $buttons_radius;
      -gtk-outline-radius: $buttons_radius;
    }

    spinbutton button { border-width: 4px; }
  }

  > toolbar.vertical {
    margin-top: -4px;

    button {
      min-height: 24px;
      min-width: 24px;
      padding: 4px;
      border-radius: $buttons_radius;
      -gtk-outline-radius: $buttons_radius;
    }
  }
}

#CanvasTable {
  button {
    min-height: 16px;
    min-width: 16px;
    padding: 0;
  }

  #HorizontalScrollbar { border-top: 1px solid $border_color; }

  #VerticalScrollbar {
    &:dir(ltr) { border-left: 1px solid $border_color; }

    &:dir(rtl) { border-right: 1px solid $border_color; }
  }
}

#Canvas_and_Dock {
  frame > border { border: none; }

  // each canvases' titlebar
  widget > widget {
    > button.flat {
      min-height: 16px;
      min-width: 16px;
      padding: 4px;
    }

    > box.horizontal image { padding: 4px; }
  }

  // vertical dock buttons
  box.horizontal > box.vertical > button.flat {
    min-height: 16px;
    min-width: 24px;
    padding: 8px 4px;
  }
}


/***********
 * Synapse *
 ***********/
box.vertical > widget > widget:selected { background-color: $primary_color; }

//
// Xfce4
//

$text_shadow: 0 0 1px rgba(0, 0, 0, 0.26),
              0 1px 2px rgba(0, 0, 0, 0.32),
              0 2px 3px rgba(0, 0, 0, 0.12);

%panelbutton {
  color: $panel_secondary_fg_color;
  border-radius: 0;
  border: none;
  box-shadow: none;
  background-color: transparent;

  &:hover:not(:active):not(:checked) {
    color: $panel_fg_color;
    box-shadow: inset 0 -2px rgba($accent_color, 0.5);
  }
  &:checked, &:active {
    color: $panel_fg_color;
    box-shadow: inset 0 -2px $accent_color;
    label, image { color: inherit; }
  }
}

.XfceHeading {
  border: 0 none transparent;
  background-color: $bg_color;
  color: $fg_color;
}

.xfce4-panel {
  background-color: $solid_panel_bg_color;
  color: $panel_secondary_fg_color;
  font-weight: 700;
  text-shadow: none;
  -gtk-icon-shadow: none;

  &, // unset borders
  frame > border { border: none; }

  &#XfcePanelWindow { // main panel container >= 4.13.3?
    // FIXME: unneeded 1px borders are reserved by its code itself
    border: none;

//    &, &.marching-ants { transition: none; } // unset transitions
  }

  button.flat { @extend %panelbutton; }

  button {
    font-weight: 700;
    @extend %panelbutton;

    &#launcher-arrow { // launcher applet
      // FIXME: quite weird pseudo-classe transitions, especially :hover
      // state can't be cleared properly ( -> an upstream issue)
      &, + button.toggle {
        &:hover { box-shadow: none; } // hide indicators
      }

      + button.toggle:checked { // 'arrow' toggle button
        color: $accent_color;
        box-shadow: none;
      }
    }

    &#xfce4-notification-plugin {
      padding: 0 1px; // for 4.12.2
    }
  }

  menu {
    font-weight: 400; // for enforcing regular weight
    text-shadow: none;
    -gtk-icon-effect: none;
  }

  widget.tasklist > button.toggle { font-weight: 400; }
}

XfdesktopIconView.view {
  border-radius: 2px;
  background: transparent;
  color: $inverse_fg_color;
  text-shadow: $text_shadow;

  &:active, &:checked {
    background-color: $primary_color;
    text-shadow: none;
  }

  .rubberband { @extend rubberband; }
}

window#whiskermenu-window {
  background-color: $base_color;

  // no CSD class even if the sw compositor was enabled.
  > frame > border {
    border-radius: 0;
  }

  entry { @extend %flat_entry; }

  scrolledwindow {
    > viewport button.radio {
      &:not(:disabled) {
        border-radius: 3px;
      }
      &:hover { background-color: $divider_color; }
      &:checked {
        background-color: $primary_color;
        color: $inverse_fg_color;
      }
    }

    treeview.view {
      &:selected:hover {
        background-color: $row_fill_color;
        color: $fg_color;
      }
    }
  }
}


//
//  * Thunar *
//

window.thunar {
  toolbar#location-toolbar {
    border-bottom: 1px solid $border_color;

    // FIXME: need to unset for weird allocation height
    entry { min-height: 0; }
  }

  notebook {
    // hide unneeded border
    stack > scrolledwindow.frame.standard-view {
      border-top-width: 0;
      border-right-width: 0;
    }

    // an allocation height of label node affects to close button's
    // image height (it's quite weird).
    header.top tab.reorderable-page > box > label { min-height: 0; }
  }
}
